home *** CD-ROM | disk | FTP | other *** search
- package javax.swing;
-
- import java.awt.Component;
- import java.awt.Container;
- import java.awt.IllegalComponentStateException;
- import java.awt.LayoutManager;
- import java.security.AccessController;
- import javax.accessibility.Accessible;
- import javax.accessibility.AccessibleContext;
- import javax.swing.plaf.RootPaneUI;
- import sun.security.action.GetBooleanAction;
-
- public class JRootPane extends JComponent implements Accessible {
- private static final String uiClassID = "RootPaneUI";
- private static final boolean LOG_DISABLE_TRUE_DOUBLE_BUFFERING = (Boolean)AccessController.doPrivileged(new GetBooleanAction("swing.logDoubleBufferingDisable"));
- private static final boolean IGNORE_DISABLE_TRUE_DOUBLE_BUFFERING = (Boolean)AccessController.doPrivileged(new GetBooleanAction("swing.ignoreDoubleBufferingDisable"));
- public static final int NONE = 0;
- public static final int FRAME = 1;
- public static final int PLAIN_DIALOG = 2;
- public static final int INFORMATION_DIALOG = 3;
- public static final int ERROR_DIALOG = 4;
- public static final int COLOR_CHOOSER_DIALOG = 5;
- public static final int FILE_CHOOSER_DIALOG = 6;
- public static final int QUESTION_DIALOG = 7;
- public static final int WARNING_DIALOG = 8;
- private int windowDecorationStyle;
- protected JMenuBar menuBar;
- protected Container contentPane;
- protected JLayeredPane layeredPane;
- protected Component glassPane;
- protected JButton defaultButton;
- /** @deprecated */
- @Deprecated
- protected DefaultAction defaultPressAction;
- /** @deprecated */
- @Deprecated
- protected DefaultAction defaultReleaseAction;
- boolean useTrueDoubleBuffering = true;
-
- public JRootPane() {
- this.setGlassPane(this.createGlassPane());
- this.setLayeredPane(this.createLayeredPane());
- this.setContentPane(this.createContentPane());
- this.setLayout(this.createRootLayout());
- this.setDoubleBuffered(true);
- this.updateUI();
- }
-
- public void setDoubleBuffered(boolean var1) {
- if (this.isDoubleBuffered() != var1) {
- super.setDoubleBuffered(var1);
- RepaintManager.currentManager(this).doubleBufferingChanged(this);
- }
-
- }
-
- public int getWindowDecorationStyle() {
- return this.windowDecorationStyle;
- }
-
- public void setWindowDecorationStyle(int var1) {
- if (var1 >= 0 && var1 <= 8) {
- int var2 = this.getWindowDecorationStyle();
- this.windowDecorationStyle = var1;
- this.firePropertyChange("windowDecorationStyle", var2, var1);
- } else {
- throw new IllegalArgumentException("Invalid decoration style");
- }
- }
-
- public RootPaneUI getUI() {
- return (RootPaneUI)this.ui;
- }
-
- public void setUI(RootPaneUI var1) {
- super.setUI(var1);
- }
-
- public void updateUI() {
- this.setUI((RootPaneUI)UIManager.getUI(this));
- }
-
- public String getUIClassID() {
- return "RootPaneUI";
- }
-
- protected JLayeredPane createLayeredPane() {
- JLayeredPane var1 = new JLayeredPane();
- var1.setName(this.getName() + ".layeredPane");
- return var1;
- }
-
- protected Container createContentPane() {
- JPanel var1 = new JPanel();
- ((JComponent)var1).setName(this.getName() + ".contentPane");
- ((JComponent)var1).setLayout(new 1(this));
- return var1;
- }
-
- protected Component createGlassPane() {
- JPanel var1 = new JPanel();
- ((JComponent)var1).setName(this.getName() + ".glassPane");
- ((JComponent)var1).setVisible(false);
- ((JPanel)var1).setOpaque(false);
- return var1;
- }
-
- protected LayoutManager createRootLayout() {
- return new RootLayout(this);
- }
-
- public void setJMenuBar(JMenuBar var1) {
- if (this.menuBar != null && this.menuBar.getParent() == this.layeredPane) {
- this.layeredPane.remove(this.menuBar);
- }
-
- this.menuBar = var1;
- if (this.menuBar != null) {
- this.layeredPane.add(this.menuBar, JLayeredPane.FRAME_CONTENT_LAYER);
- }
-
- }
-
- /** @deprecated */
- @Deprecated
- public void setMenuBar(JMenuBar var1) {
- if (this.menuBar != null && this.menuBar.getParent() == this.layeredPane) {
- this.layeredPane.remove(this.menuBar);
- }
-
- this.menuBar = var1;
- if (this.menuBar != null) {
- this.layeredPane.add(this.menuBar, JLayeredPane.FRAME_CONTENT_LAYER);
- }
-
- }
-
- public JMenuBar getJMenuBar() {
- return this.menuBar;
- }
-
- /** @deprecated */
- @Deprecated
- public JMenuBar getMenuBar() {
- return this.menuBar;
- }
-
- public void setContentPane(Container var1) {
- if (var1 == null) {
- throw new IllegalComponentStateException("contentPane cannot be set to null.");
- } else {
- if (this.contentPane != null && this.contentPane.getParent() == this.layeredPane) {
- this.layeredPane.remove(this.contentPane);
- }
-
- this.contentPane = var1;
- this.layeredPane.add(this.contentPane, JLayeredPane.FRAME_CONTENT_LAYER);
- }
- }
-
- public Container getContentPane() {
- return this.contentPane;
- }
-
- public void setLayeredPane(JLayeredPane var1) {
- if (var1 == null) {
- throw new IllegalComponentStateException("layeredPane cannot be set to null.");
- } else {
- if (this.layeredPane != null && this.layeredPane.getParent() == this) {
- this.remove(this.layeredPane);
- }
-
- this.layeredPane = var1;
- this.add(this.layeredPane, -1);
- }
- }
-
- public JLayeredPane getLayeredPane() {
- return this.layeredPane;
- }
-
- public void setGlassPane(Component var1) {
- if (var1 == null) {
- throw new NullPointerException("glassPane cannot be set to null.");
- } else {
- boolean var2 = false;
- if (this.glassPane != null && this.glassPane.getParent() == this) {
- this.remove(this.glassPane);
- var2 = this.glassPane.isVisible();
- }
-
- var1.setVisible(var2);
- this.glassPane = var1;
- this.add(this.glassPane, 0);
- if (var2) {
- this.repaint();
- }
-
- }
- }
-
- public Component getGlassPane() {
- return this.glassPane;
- }
-
- public boolean isValidateRoot() {
- return true;
- }
-
- public boolean isOptimizedDrawingEnabled() {
- return !this.glassPane.isVisible();
- }
-
- public void addNotify() {
- SystemEventQueueUtilities.addRunnableCanvas(this);
- super.addNotify();
- this.enableEvents(8L);
- }
-
- public void removeNotify() {
- SystemEventQueueUtilities.removeRunnableCanvas(this);
- super.removeNotify();
- }
-
- public void setDefaultButton(JButton var1) {
- JButton var2 = this.defaultButton;
- if (var2 != var1) {
- this.defaultButton = var1;
- if (var2 != null) {
- var2.repaint();
- }
-
- if (var1 != null) {
- var1.repaint();
- }
- }
-
- this.firePropertyChange("defaultButton", var2, var1);
- }
-
- public JButton getDefaultButton() {
- return this.defaultButton;
- }
-
- final void setUseTrueDoubleBuffering(boolean var1) {
- this.useTrueDoubleBuffering = var1;
- }
-
- final boolean getUseTrueDoubleBuffering() {
- return this.useTrueDoubleBuffering;
- }
-
- final void disableTrueDoubleBuffering() {
- if (this.useTrueDoubleBuffering && !IGNORE_DISABLE_TRUE_DOUBLE_BUFFERING) {
- if (LOG_DISABLE_TRUE_DOUBLE_BUFFERING) {
- System.out.println("Disabling true double buffering for " + this);
- Thread.dumpStack();
- }
-
- this.useTrueDoubleBuffering = false;
- RepaintManager.currentManager(this).doubleBufferingChanged(this);
- }
-
- }
-
- protected void addImpl(Component var1, Object var2, int var3) {
- super.addImpl(var1, var2, var3);
- if (this.glassPane != null && this.glassPane.getParent() == this && this.getComponent(0) != this.glassPane) {
- this.add(this.glassPane, 0);
- }
-
- }
-
- protected String paramString() {
- return super.paramString();
- }
-
- public AccessibleContext getAccessibleContext() {
- if (this.accessibleContext == null) {
- this.accessibleContext = new AccessibleJRootPane(this);
- }
-
- return this.accessibleContext;
- }
- }
-